import {createContext,useState,useContext} from 'react';

const AuthContext = createContext();

export const useAuth = () => {
    return useContext(AuthContext);

}

export const AuthProvider = (props) => {

    const [isLogin, setIsLogin] = useState(localStorage.getItem('isLogin') || '');

    //间所有的逻辑内容生成组件，用组件去套内容
    return (<AuthContext.Provider value={{isLogin,setIsLogin}}>
        {props.children}
    </AuthContext.Provider>)
}
// export default AuthProvider